# -*- coding:UTF-8 -*-
"""
date: 		2015-04-17
author:		laotou99
Desc:    	一个超简单的文字类游戏啊
"""

import enemy
#import player1
import os
import time
import sqlite3

#os.getcwd()

str1=['aaa','bbb','ccc']
str2=[]
A1=""
ilevel1 = 0
bool1 = False
conn = sqlite3.connect("tmp.db")
#-class--------------------------------
class Player:
	iHP = 0 	#血量
	iSP = 0 	#体力值
	iMP = 0 	#魔法值
	iAtt = 0 	#攻击值
	iDef = 0 	#防御值
	iLevel = 0 	#等级
	pass
	#def __init__(self):
	#	self.iHP = 100
	#	self.iSP = 100
		#print self.iLevel,'Player'
	def __init__(self,i1=0,i2=0):
		self.iHP = i1
		self.iSP = i2
		self.iMP = 100
		self.iAtt = 5
		print 'Player:',self.iHP,'->self.iHP',self.iSP,'->self.iSP',self.iMP,'->self.iMP'
		#print self.iLevel,'Player'
	def getHurt(self,iiHP):
		print "我方受到:",iiHP,"点攻击"
		time.sleep(0.5)
		self.iHP = self.iHP - iiHP
		print '还剩:',self.iHP,'点血量'
		time.sleep(0.5)
	def setHP(self,iHP):
		self.iHP= iHP
		print(iHP)
	def getAtth(self,iAtth):
		self.iHP = self.iHP - iAtth
		print(iHP)
	def takeAtth(self,Enemy,iAtth=10):
		Enemy.iHP = Enemy.iHP - iAtth 
		print(Enemy.iHP)
	def getLevel(self):
		return self.iLevel
	def getHP(self):
		return self.iHP
	def getSP(self):
		return self.iSP
	def getMP(self):
		return self.iMP
	def getAtth(self):
		return self.iAtt



#---Mathod-----------------------------

player1=Player(100,100)
#enemy1=enemy.Enemy(100,100)
enemy1=""
#初始化游戏
def initGame():
	print '初始化游戏中。。。。'
	global player1,enemy1
	global ilevel1

def startNewGame():
	#print 'NewGame'
	print '****************************'
	print '即将开始新的游戏所有的数据将被清空'
	print '****************************'
	loopGame1()

def startLoadGame():
	print 'LoadGame'
	print '****************************'
	print '即将开始加载游戏数据'
	print '****************************'
	loopGame1()

def loopGame1():
	pass
	initGame()
	pass
	#print 'loopGame'
	print '****************************'
	print '1，选择关卡'
	print '2，等级查看'
	print '3，装备选择'
	print '4，返回主界面'
	print '****************************'
	a1 = raw_input('请选择项目号：')
	if a1 == '1':
		#print a1,"->1"
		levelChoice()
	elif a1 == '2':
		print a1,"->2"
		viewInfo()
	elif a1 == '3':
		print a1,"->3"
		itemChoice()
	elif a1 == '4':
		print a1,"->4"
		backToLogin()

def backToLogin():
	print 'backToLogin'
def itemChoice():
	print 'itemChoice'
def levelChoice():
	#print 'levelChoice'
	print player1.getLevel(),' 为当前玩家等级'
	i1=player1.getLevel() 
	showLevel(i1)
def viewInfo():
	print 'viewInfo'
def showLevel(i1):
	print '显示可选关卡'
	inA1 =['1，第一关','2，第二关','3，第三关','4，第四关','5，第五关','6，第六关','7，第七关']	
	i1 = i1 + 1
	for i in range(i1):
		print inA1[i]
	print '请选择要攻打的关卡'
	a1 = raw_input("请输入数字：")
	print a1,"为您选择的关卡"
	ilevel1 = a1
	#print ilevel1
	global enemy1
	if ilevel1=='1':
		#print "------1111-1-1-1-1-1-1-"
		enemy1=enemy.Enemy(50,10)
def showDFData():
	#print 'showDFData()'
	print '敌方战斗信息：'
	#print 'HP:',enemy1.iHP
	print 'HP:',enemy1.getHP(),' SP:',enemy1.getSP(),' MP:',enemy1.getMP()
def showZFData():
	#print 'showZFData'
	print '我方战斗信息：'
	print 'HP:',player1.getHP(),' SP:',player1.getSP(),' MP:',player1.getMP()
#---Main------------------------

print '****************************'
print '          超简单文字游戏'
print '           Start  Game'
print '          1 New   Game'
print '          2 Load  Game'
print '          3 About Game'
print '****************************'

a1 = raw_input("Select Number:")
#print a1,'->a1'
pass
if a1 == '1':
	#print a1,"->1"
	#print 'New Game'
	startNewGame()
elif a1 == '2':
	#print a1,"->2"
	print 'Load Game'
	startLoadGame()
print '战斗开始：'
while(True):
	aa = 1
	print bool1
	if bool1==True:
		print '敌方战斗'
		player1.getHurt(enemy1.getAtth())
		pass
		pass
		bool1=False
	time.sleep(1.2)
	print '----------------------------'
	print '$$$@@__New Around__@@$$$'
	showDFData()
	time.sleep(0.6)
	print '----------------------------'
	print '|                          |'
	print '----------------------------'
	showZFData()
	time.sleep(0.6)
	print '可用战斗指令：'
	print '1,攻击 2,魔法 3,防御 4,quit 退出'
	pass	
	s = raw_input('请输入你的选择：')
	if s=='quit':
		break
	elif s=='1':
		print '攻击敌方'
		enemy1.getHurt(player1.getAtth())
		bool1=True	
		continue
	elif s=='2':
		continue
	elif s=='3':
		continue
	else:
		print s,'无此选项'


#-----------------------------------




print '****************************'
print '         游戏结束'
#-----------------------------------
#player1 = Player()
#enemy1 = enemy.Enemy()
#player1.setHP(100)
#player1.takeAtth(enemy1)

'''	if i1==0:
		print '1，第一关'
	elif i1==2:
		print '2，第二关'
	elif i1==2:
		print '3，第三关'
	elif i1==3:
		print '4，第四关'
	elif i1==4:
		print '5，第五关'
	elif i1==5:
		print '6，第六关'
	elif i1==6:
		print '7，第七关' '''
